package com.thinqq.web.client.content.painter;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.thinqq.web.client.ThinqQImageBundle;
import com.thinqq.web.client.constants.CSSConstants;
import com.thinqq.web.client.content.InformationTechnology;
import com.thinqq.web.client.content.handler.LinkClickHandler;

public class InformationTechnologyContentPainter implements IContentPainter{

	
	private void updateMainAreaConent(HorizontalPanel mainContent,VerticalPanel relatedContent) {
		mainContent.clear();
		FlowPanel mainITPanel = new FlowPanel();
		InformationTechnology itContent = GWT.create(InformationTechnology.class);
		ThinqQImageBundle imageBundle = GWT.create(ThinqQImageBundle.class);
		Label title = new Label(itContent.title());
		title.setStyleName(CSSConstants.CSS_MAIN_CONTENT_TITLE);
		
		mainITPanel.setStyleName(CSSConstants.MAIN_CONTENT_COMMON_STYLE);
		mainITPanel.add(title);
		mainITPanel.add(new Label(itContent.oneLiner()));
		Image itContentImage = new Image(imageBundle.getITContentImage());
		Grid grid = new Grid(1,2);
		grid.setWidget(0,0,itContentImage);
		FlowPanel itContentPanel = new FlowPanel();
		Label servicesListOneliner = new Label(itContent.itServicesListOneLiner());
		servicesListOneliner.addStyleName(CSSConstants.UNORDERED_BULLET_LEVEL_1);
		itContentPanel.add(servicesListOneliner);
		//Application Development
		Anchor appDevLink = new Anchor(itContent.appDev());
		appDevLink.addClickHandler(new LinkClickHandler(ContentPainterRegistry.getContentPainter(ContentPainterRegistry.APPLICATION_DEVELOPMENT), mainContent, relatedContent));
		appDevLink.addStyleName(CSSConstants.UNORDERED_BULLET);
		itContentPanel.add(appDevLink );
		Label appDevOneLiner = new Label(itContent.appDevOneLiner());
		appDevOneLiner.addStyleName(CSSConstants.UNORDERED_BULLET_LEVEL_1);
		itContentPanel.add(appDevOneLiner );
		//Application Enhancement
		Anchor appEnhance = new Anchor(itContent.appEnhance());
		appEnhance.addClickHandler(new LinkClickHandler(ContentPainterRegistry.getContentPainter(ContentPainterRegistry.COMMUNICATION_CONTENT), mainContent, relatedContent));
		appEnhance.addStyleName(CSSConstants.UNORDERED_BULLET);
		itContentPanel.add(appEnhance );
		Label appEnhanceOneLiner = new Label(itContent.appEnhanceOneLiner());
		appEnhanceOneLiner.addStyleName(CSSConstants.UNORDERED_BULLET_LEVEL_1);
		itContentPanel.add(appEnhanceOneLiner );
		//System Re-Engineering
		Anchor sysReengg = new Anchor(itContent.sysReengg());
		sysReengg.addClickHandler(new LinkClickHandler(ContentPainterRegistry.getContentPainter(ContentPainterRegistry.COMMUNICATION_CONTENT), mainContent, relatedContent));
		sysReengg.addStyleName(CSSConstants.UNORDERED_BULLET);
		itContentPanel.add(sysReengg );
		Label sysReenggOneLiner = new Label(itContent.sysReenggOneLiner());
		sysReenggOneLiner.addStyleName(CSSConstants.UNORDERED_BULLET_LEVEL_1);
		itContentPanel.add(sysReenggOneLiner );
		//Architecture Consulting
		Anchor archConsulting = new Anchor(itContent.archConsulting());
		archConsulting.addClickHandler(new LinkClickHandler(ContentPainterRegistry.getContentPainter(ContentPainterRegistry.COMMUNICATION_CONTENT), mainContent, relatedContent));
		archConsulting.addStyleName(CSSConstants.UNORDERED_BULLET);
		itContentPanel.add(archConsulting );
		Label archConsultingOneLiner = new Label(itContent.archConsultingOneLiner());
		archConsultingOneLiner.addStyleName(CSSConstants.UNORDERED_BULLET_LEVEL_1);
		itContentPanel.add(archConsultingOneLiner );
		grid.setWidget(0,1,itContentPanel);
		mainITPanel.add(grid);
		mainContent.add(mainITPanel);
	}

	public void updateRelatedAreaContent(VerticalPanel relatedContent) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void updateConent(HorizontalPanel mainContent,
			VerticalPanel relatedContent) {
		updateMainAreaConent(mainContent,relatedContent);
		updateRelatedAreaContent(relatedContent);
		
	}

}
